import { h } from 'vue'
import { ApartmentOutlined, AreaChartOutlined } from '@ant-design/icons-vue'
import type { FormOptions } from '@/components/ui/form/src/types/type'
import { CASE_STATUS } from '@/config/map'
import { FormSearchFilter } from '@/utils'

const caseFormOptions: FormOptions[] = [
  {
    type: 'input',
    value: '',
    label: 'Case name',
    prop: 'name',
    required: 'name',
    attrs: {
      allowClear: true,
    },
    rules: [
      {
        message: 'Please enter the casename',
        required: true,
        trigger: 'blur',
      },
      {
        max: 30,
        message: 'The casename is between 2 and 30 characters',
        min: 2,
        trigger: 'blur',
      },
    ],
  },
  {
    type: 'select',
    value: 'NO_RESULT',
    label: 'Case Status',
    prop: 'status',
    placeholder: 'Please select the status',
    attrs: {
      allowClear: true,
      disabled: true,
      style: {
        width: '100%',
      },
    },
    children: [
      {
        label: 'NO_RESULT',
        type: 'select-option',
        value: 'NO_RESULT',
      },
      {
        label: 'CALCULATING',
        type: 'select-option',
        value: 'CALCULATING',
      },
      {
        label: 'HAS_RESULT',
        type: 'select-option',
        value: 'HAS_RESULT',
      },
      {
        label: 'BAD_CASES',
        type: 'select-option',
        value: 'BAD_CASES',
      },
    ],
  },
  {
    type: 'switch',
    value: false,
    label: 'Disabled',
    prop: 'disabled',
  },
  {
    type: 'switch',
    value: false,
    label: 'Shared',
    prop: 'shared',
  },
  {
    attrs: {
      allowClear: true,
    },
    label: 'Remark',
    prop: 'remark',
    required: 'remark',
    rules: [
      {
        message: 'Please enter the remark',
        required: true,
        trigger: 'blur',
      },
      {
        min: 1,
        max: 50,
        message: 'The remark is between 1 and 50 characters',
        trigger: 'blur',
      },
    ],
    type: 'input',
    value: '',
  },
]

const searchFormOptions: FormOptions[] = [
  {
    type: 'select',
    value: '',
    label: 'Case Name',
    prop: 'name',
    placeholder: 'Please select the case name',
    attrs: {
      'allowClear': true,
      'show-search': true,
      'filter-option': FormSearchFilter,
      'style': {
        width: '100%',
      },
    },
    children: [],
  },
  {
    type: 'select',
    value: '',
    label: 'Case Status',
    prop: 'status',
    placeholder: 'Please select the case status',
    attrs: {
      'allowClear': true,
      'show-search': true,
      'filter-option': FormSearchFilter,
      'style': {
        width: '100%',
      },
    },
    children: [
      {
        label: 'NO_RESULT',
        type: 'select-option',
        value: 'NO_RESULT',
      },
      {
        label: 'CALCULATING',
        type: 'select-option',
        value: 'CALCULATING',
      },
      {
        label: 'HAS_RESULT',
        type: 'select-option',
        value: 'HAS_RESULT',
      },
      {
        label: 'BAD_CASES',
        type: 'select-option',
        value: 'BAD_CASES',
      },
    ],
  },
]

const processes = [
  {
    title: 'Preprocessing Step',
    icon: h(ApartmentOutlined),
  },
  {
    title: 'Caculation Result',
    // title: 'Clean Sampling Normalization DR Cluster',
    // title: 'Clean',
    icon: h(AreaChartOutlined),
  },
  // {
  //   title: 'Sampling',
  //   icon: h(BoxPlotOutlined),
  // },
  // {
  //   title: 'Normalization',
  //   icon: h(BoxPlotOutlined),
  // },
  // {
  //   title: 'DR',
  //   icon: h(BoxPlotOutlined),
  // },
  // {
  //   title: 'Cluster',
  //   icon: h(BoxPlotOutlined),
  // },
  {
    title: 'SOM',
    icon: h(AreaChartOutlined),
  },
  {
    title: 'Sensitivity analysis',
    icon: h(AreaChartOutlined),
  },
  {
    title: 'Optimization',
    icon: h(AreaChartOutlined),
  },
  {
    title: 'Contribution',
    icon: h(AreaChartOutlined),
  },
]

const baseFormLayout = {
  labelCol: { span: 10 },
  wrapperCol: { span: 14 },
}

const searchFormLayout = {
  labelCol: { span: 4 },
  wrapperCol: { span: 8 },
}

const selectFormOptions: FormOptions[] = [
  {
    type: 'select',
    value: '',
    label: 'Select Dataset',
    required: 'dataset_uuid',
    prop: 'dataset_uuid',
    placeholder: 'Please select a dataset',
    attrs: {
      allowClear: true,
      style: {
        width: '100%',
      },
    },
    rules: [
      {
        required: true,
        message: 'Please select a dataset',
        trigger: 'change',
      },
    ],
    children: [],
  },
  // {
  //   type: 'select',
  //   value: 1,
  //   label: 'Select Process',
  //   required: 'process',
  //   prop: 'process',
  //   placeholder: 'Please select a process',
  //   attrs: {
  //     style: {
  //       width: '100%',
  //     },
  //   },
  //   rules: [
  //     {
  //       required: true,
  //       message: 'Please select a process',
  //       trigger: 'change',
  //     },
  //   ],
  //   children: [
  //     {
  //       type: 'select-option',
  //       value: 1,
  //       label: 'Clean - Sampling - Normalization - DR - Cluster',
  //     },
  //     {
  //       type: 'select-option',
  //       value: 2,
  //       label: 'Clean - Sampling - Normalization - DR - Cluster - SOM',
  //     },
  //     {
  //       type: 'select-option',
  //       value: 3,
  //       label: 'Clean - Sampling - Normalization - DR - Cluster - Sensitivity analysis',
  //     },
  //     {
  //       type: 'select-option',
  //       value: 4,
  //       label: 'Clean - Sampling - Normalization - DR - Cluster - Optimization',
  //     },
  //     {
  //       type: 'select-option',
  //       value: 5,
  //       label: 'Clean - Sampling - Normalization - DR - Cluster - Contribution',
  //     },
  //   ],
  // },
]

const cleanFormOptions: FormOptions[] = [
  {
    type: 'switch',
    value: true,
    label: 'Clean Non-Numeric',
    required: 'clean_non_numeric',
    prop: 'clean_non_numeric',
    rules: [
      {
        required: true,
        message: 'Please select the clean_non_numeric',
        trigger: 'change',
      },
    ],
  },
  {
    type: 'select',
    value: null,
    label: 'Repair method',
    required: 'repair_method',
    prop: 'repair_method',
    placeholder: 'Please enter a method',
    attrs: {
      allowClear: true,
      style: {
        width: '100%',
      },
    },
    rules: [
      {
        required: true,
        message: 'Please select a method',
        trigger: 'change',
      },
    ],
    children: [
      {
        type: 'select-option',
        value: 0,
        label: 'Interplolate',
      },
      {
        type: 'select-option',
        value: 1,
        label: 'Fill Means',
      },
      {
        type: 'select-option',
        value: 2,
        label: 'Delete Missing',
      },
    ],
  },
  {
    type: 'switch',
    value: true,
    label: 'Clean outlier',
    required: 'clean_outlier',
    prop: 'clean_outlier',
    rules: [
      {
        required: true,
        message: 'Please select the clean_outlier',
        trigger: 'change',
      },
    ],
  },
  {
    type: 'input-number',
    value: null,
    label: 'Clean outlier paras',
    required: 'clean_outlier_paras',
    prop: 'clean_outlier_paras',
    attrs: {
      min: 0,
      max: 100,
      style: {
        width: '100%',
      },
    },
    rules: [
      {
        required: true,
        message: 'The number of clean_outlier_paras is between 0 and 100',
        trigger: 'blur',
      },
    ],
  },
  {
    type: 'switch',
    value: true,
    label: 'Clean Missing Data',
    required: 'clean_Missing_Data',
    prop: 'clean_Missing_Data',
    rules: [
      {
        required: true,
        message: 'Please select the clean_Missing_Data',
        trigger: 'change',
      },
    ],
  },
]

const samplingFormOptions: FormOptions[] = [
  {
    type: 'select',
    value: null,
    label: 'Method',
    required: 'method',
    prop: 'method',
    placeholder: 'Please enter a method',
    attrs: {
      allowClear: true,
      style: {
        width: '100%',
      },
    },
    rules: [
      {
        required: true,
        message: 'Please select a method',
        trigger: 'change',
      },
    ],
    children: [
      {
        type: 'select-option',
        value: 0,
        label: 'None',
      },
      {
        type: 'select-option',
        value: 1,
        label: 'Random Sampling',
      },
      {
        type: 'select-option',
        value: 2,
        label: 'Avg Sampling',
      },
      {
        type: 'select-option',
        value: 3,
        label: 'cNN Sampling',
      },
    ],
  },
  {
    type: 'input-number',
    value: null,
    label: 'Interval',
    required: 'interval',
    prop: 'interval',
    attrs: {
      min: 0,
      allowClear: true,
      style: {
        width: '100%',
      },
    },
    rules: [
      {
        required: true,
        message: 'The number of n_components must be greater then 0',
        trigger: 'blur',
      },
    ],
  },
]

const normalizationFormOptions: FormOptions[] = [
  {
    type: 'select',
    value: null,
    label: 'Method',
    required: 'method',
    prop: 'method',
    placeholder: 'Please enter a method',
    attrs: {
      allowClear: true,
      style: {
        width: '100%',
      },
    },
    rules: [
      {
        required: true,
        message: 'Please select a method',
        trigger: 'change',
      },
    ],
    children: [
      {
        type: 'select-option',
        value: 1,
        label: 'Z-Score',
      },
      {
        type: 'select-option',
        value: 2,
        label: 'Over Max',
      },
      {
        type: 'select-option',
        value: 3,
        label: 'Over Mean',
      },
      {
        type: 'select-option',
        value: 4,
        label: 'Over Range (Max-Min)',
      },
    ],
  },
]

const DRFormOptions: FormOptions[] = [
  {
    type: 'select',
    value: 1,
    label: 'Method',
    required: 'method',
    prop: 'method',
    placeholder: 'Please enter a method',
    attrs: {
      allowClear: true,
      style: {
        width: '100%',
      },
    },
    rules: [
      {
        required: true,
        message: 'Please select a method',
        trigger: 'change',
      },
    ],
    children: [
      {
        type: 'select-option',
        value: 0,
        label: 'None',
      },
      {
        type: 'select-option',
        value: 1,
        label: 'PCA',
      },
      {
        type: 'select-option',
        value: 2,
        label: 'UMAP',
      },
      {
        type: 'select-option',
        value: 3,
        label: 'PaCMAP',
      },
      {
        type: 'select-option',
        value: 4,
        label: 'ICA',
      },
      {
        type: 'select-option',
        value: 5,
        label: 'Spectral Embedding',
      },
      {
        type: 'select-option',
        value: 6,
        label: 't-SNE',
      },
      {
        type: 'select-option',
        value: 7,
        label: 'TriMap',
      },
    ],
  },
  {
    type: 'input-number',
    value: 3,
    label: 'n_components',
    required: 'n_components',
    prop: 'n_components',
    attrs: {
      min: 1,
      allowClear: true,
      style: {
        width: '100%',
      },
    },
    rules: [
      {
        required: true,
        message: 'The number of n_components must be greater then 1',
        trigger: 'blur',
      },
    ],
  },
  {
    type: 'input',
    value: 'default',
    label: 'n_neigh',
    required: 'n_neigh',
    prop: 'n_neigh',
    attrs: {
      allowClear: true,
      min: 1,
      max: 50,
      style: {
        width: '100%',
      },
    },
    rules: [
      {
        required: true,
        message: 'The number of n_neigh is between 1 and 50',
        trigger: 'blur',
      },
    ],
  },
  {
    type: 'input-number',
    value: 0.5,
    label: 'MN_ratio',
    required: 'MN_ratio',
    prop: 'MN_ratio',
    attrs: {
      min: 0,
      max: 10,
      allowClear: true,
      style: {
        width: '100%',
      },
    },
    rules: [
      {
        required: true,
        message: 'The number of MN_ratio is between 0 and 10',
        trigger: 'blur',
      },
    ],
  },
  {
    type: 'input-number',
    value: 2,
    label: 'FP_ratio',
    required: 'FP_ratio',
    prop: 'FP_ratio',
    attrs: {
      min: 0,
      max: 10,
      allowClear: true,
      style: {
        width: '100%',
      },
    },
    rules: [
      {
        required: true,
        message: 'The number of FP_ratio is between 0 and 10',
        trigger: 'blur',
      },
    ],
  },
  {
    type: 'input-number',
    value: 450,
    label: 'num_iters',
    required: 'num_iters',
    prop: 'num_iters',
    attrs: {
      min: 250,
      max: 1000,
      allowClear: true,
      style: {
        width: '100%',
      },
    },
    rules: [
      {
        required: true,
        message: 'The number of num_iters is between 250 and 1000',
        trigger: 'blur',
      },
    ],
  },
  {
    type: 'select',
    value: 'pca',
    label: 'init',
    required: 'pacmapinit',
    prop: 'pacmapinit',
    placeholder: 'Please select a pacmapinit',
    attrs: {
      allowClear: true,
      style: {
        width: '100%',
      },
    },
    rules: [
      {
        required: true,
        message: 'Please select a pacmapinit',
        trigger: 'change',
      },
    ],
    children: [
      {
        type: 'select-option',
        value: 'pca',
        label: 'pca',
      },
      {
        type: 'select-option',
        value: 'random',
        label: 'random',
      },
    ],
  },
  {
    type: 'input-number',
    value: 2,
    label: 'perplexity',
    required: 'perplexity',
    prop: 'perplexity',
    attrs: {
      min: 5,
      max: 50,
      allowClear: true,
      style: {
        width: '100%',
      },
    },
    rules: [
      {
        required: true,
        message: 'The number of perplexity is between 5 and 50',
        trigger: 'blur',
      },
    ],
  },
]

const clusterFormOptions: FormOptions[] = [
  {
    type: 'select',
    value: 1,
    label: 'Method',
    required: 'method',
    prop: 'method',
    placeholder: 'Please select a method',
    attrs: {
      allowClear: true,
      style: {
        width: '100%',
      },
    },
    rules: [
      {
        required: true,
        message: 'Please select a method',
        trigger: 'change',
      },
    ],
    children: [
      {
        type: 'select-option',
        value: 0,
        label: 'None',
      },
      {
        type: 'select-option',
        value: 1,
        label: 'K-Means',
      },
      {
        type: 'select-option',
        value: 2,
        label: 'DBSCAN',
      },
      {
        type: 'select-option',
        value: 3,
        label: 'MeanShift',
      },
      {
        type: 'select-option',
        value: 4,
        label: 'BIRCH',
      },
      {
        type: 'select-option',
        value: 5,
        label: 'HDBSCAN',
      },
    ],
  },
  {
    type: 'input-number',
    value: 3,
    label: 'n_clusters',
    required: 'n_clusters',
    prop: 'n_clusters',
    attrs: {
      min: 0,
      max: 100,
      allowClear: true,
      style: {
        width: '100%',
      },
    },
    rules: [
      {
        required: true,
        message: 'The number of n_clusters is between 0 and 100',
        trigger: 'blur',
      },
    ],
  },
  {
    type: 'input-number',
    value: 'default',
    label: 'epsilon',
    required: 'epsilon',
    prop: 'epsilon',
    attrs: {
      allowClear: true,
      style: {
        width: '100%',
      },
    },
    rules: [
      {
        required: true,
        message: 'Please enter the epsilon',
        trigger: 'blur',
      },
    ],
  },
  {
    type: 'input-number',
    value: 10,
    label: 'minsamp1',
    required: 'minsamp1',
    prop: 'minsamp1',
    attrs: {
      min: 1,
      max: 50,
      allowClear: true,
      style: {
        width: '100%',
      },
    },
    rules: [
      {
        required: true,
        message: 'The number of minsamp1 is between 1 and 50',
        trigger: 'blur',
      },
    ],
  },
  {
    type: 'input-number',
    value: 'default',
    label: 'bandwidth1',
    required: 'bandwidth1',
    prop: 'bandwidth1',
    attrs: {
      min: 0,
      max: 50,
      allowClear: true,
      style: {
        width: '100%',
      },
    },
    rules: [
      {
        required: true,
        message: 'The number of minsamp1 is between 0 and 50',
        trigger: 'blur',
      },
    ],
  },
  {
    type: 'input-number',
    value: 3,
    label: 'nclust2',
    required: 'nclust2',
    prop: 'nclust2',
    attrs: {
      min: 1,
      max: 50,
      allowClear: true,
      style: {
        width: '100%',
      },
    },
    rules: [
      {
        required: true,
        message: 'The number of nclust2 is between 1 and 50',
        trigger: 'blur',
      },
    ],
  },
  {
    type: 'input-number',
    value: 'default',
    label: 'threshold1',
    required: 'threshold1',
    prop: 'threshold1',
    attrs: {
      min: 0,
      max: 50,
      allowClear: true,
      style: {
        width: '100%',
      },
    },
    rules: [
      {
        required: true,
        message: 'The number of nclust2 is between 0 and 50',
        trigger: 'blur',
      },
    ],
  },
  {
    type: 'input-number',
    value: 50,
    label: 'branch_factor',
    required: 'branch_factor',
    prop: 'branch_factor',
    attrs: {
      min: 2,
      max: 500,
      allowClear: true,
      style: {
        width: '100%',
      },
    },
    rules: [
      {
        required: true,
        message: 'The number of branch_factor is between 2 and 500',
        trigger: 'blur',
      },
    ],
  },
  {
    type: 'input-number',
    value: 10,
    label: 'minsamp2',
    required: 'minsamp2',
    prop: 'minsamp2',
    attrs: {
      min: 1,
      max: 50,
      allowClear: true,
      style: {
        width: '100%',
      },
    },
    rules: [
      {
        required: true,
        message: 'The number of minsamp2 is between 1 and 50',
        trigger: 'blur',
      },
    ],
  },
]

const somFormOptions: FormOptions[] = [
  {
    type: 'input-number',
    value: null,
    label: 'map_l',
    required: 'map_l',
    prop: 'map_l',
    attrs: {
      min: 2,
      max: 100,
      allowClear: true,
      style: {
        width: '100%',
      },
    },
    rules: [
      {
        required: true,
        message: 'The number of map_l is between 2 and 100',
        trigger: 'blur',
      },
    ],
  },
  {
    type: 'input-number',
    value: null,
    label: 'map_w',
    required: 'map_w',
    prop: 'map_w',
    attrs: {
      min: 2,
      max: 100,
      allowClear: true,
      style: {
        width: '100%',
      },
    },
    rules: [
      {
        required: true,
        message: 'The number of map_w is between 2 and 100',
        trigger: 'blur',
      },
    ],
  },
]

const contributionFormOptions: FormOptions[] = [
  {
    type: 'select',
    value: null,
    label: 'DR method',
    required: 'method',
    prop: 'method',
    placeholder: 'Please select a method',
    attrs: {
      allowClear: true,
      style: {
        width: '100%',
      },
    },
    rules: [
      {
        required: true,
        message: 'Please select a method',
        trigger: 'change',
      },
    ],
    children: [
      {
        type: 'select-option',
        value: 1,
        label: 'PCA',
      },
      {
        type: 'select-option',
        value: 2,
        label: 'SGS',
      },
    ],
  },
  {
    type: 'input-number',
    value: null,
    label: 'Cluster 1',
    required: 'label1',
    prop: 'label1',
    attrs: {
      style: {
        width: '100%',
      },
    },
    rules: [
      {
        required: true,
        trigger: 'blur',
      },
    ],
    // children: [],
  },
  {
    type: 'input-number',
    value: null,
    label: 'Cluster 2',
    required: 'label2',
    prop: 'label2',
    attrs: {
      style: {
        width: '100%',
      },
    },
    rules: [
      {
        required: true,
        trigger: 'blur',
      },
    ],
    // children: [],
  },
]

const optimizationFormOptions: FormOptions[] = [
  {
    type: 'select',
    value: [],
    label: 'DR Methods',
    required: 'dr_methods',
    prop: 'dr_methods',
    placeholder: 'Please select a dr_methods',
    attrs: {
      allowClear: true,
      style: {
        width: '100%',
      },
      mode: 'multiple',
    },
    rules: [
      {
        required: true,
        message: 'Please select a dr_methods',
        trigger: 'change',
      },
    ],
    children: [
      {
        type: 'select-option',
        value: 'PCA',
        label: 'PCA',
      },
      {
        type: 'select-option',
        value: 'UMAP',
        label: 'UMAP',
      },
      {
        type: 'select-option',
        value: 'PaCMAP',
        label: 'PaCMAP',
      },
    ],
  },
  {
    type: 'select',
    value: [],
    label: 'Clustering methods',
    required: 'cl_methods',
    prop: 'cl_methods',
    placeholder: 'Please select a cl_methods',
    attrs: {
      allowClear: true,
      mode: 'multiple',
      style: {
        width: '100%',
      },
    },
    rules: [
      {
        required: true,
        message: 'Please select a cl_methods',
        trigger: 'change',
      },
    ],
    children: [
      {
        type: 'select-option',
        value: 'KMEANS',
        label: 'KMEANS',
      },
      {
        type: 'select-option',
        value: 'DBSCAN',
        label: 'DBSCAN',
      },
      {
        type: 'select-option',
        value: 'HDBSCAN',
        label: 'HDBSCAN',
      },
    ],
  },
]

const optimizationColumns = [
  { align: 'center', dataIndex: 'Ensemble', title: 'Ensemble', customRender: ({ value }: { value: string[] }) => {
    return value.map((item: string) => {
      return (
        <a-tag key={item}>{item}</a-tag>
      )
    })
  } },
  { align: 'center', dataIndex: 'sil_score', title: 'sil_score' },
  { align: 'center', dataIndex: 'dbi_score', title: 'dbi_score' },
  { align: 'center', dataIndex: 'n_comp', title: 'n_comp' },
  { align: 'center', dataIndex: 'n_neighbors', title: 'n_neighbors' },
  { align: 'center', dataIndex: 'min_dist', title: 'min_dist' },
  { align: 'center', dataIndex: 'n_components', title: 'n_components' },
  { align: 'center', dataIndex: 'n_clusters', title: 'n_clusters' },
  { align: 'center', dataIndex: 'min_cluster_size', title: 'min_cluster_size' },
  { align: 'center', dataIndex: 'cluster_selection_epsilon', title: 'cluster_selection_epsilon' },
  { align: 'center', dataIndex: 'min_samples', title: 'min_samples' },
  { align: 'center', dataIndex: 'eps', title: 'eps' },
  { align: 'center', dataIndex: 'KNN_neighbors', title: 'KNN_neighbors' },
  { align: 'center', dataIndex: 'DR_Parameters', title: 'DR_Parameters' },
  { align: 'center', dataIndex: 'Cluster_Parameters', title: 'Cluster_Parameters' },
]

const sensitiveFormOptions: FormOptions[] = [
  {
    type: 'select',
    value: null,
    label: 'Analysis Step',
    required: 'analysis_step',
    prop: 'analysis_step',
    placeholder: 'Please select a analysis_step',
    attrs: {
      allowClear: true,
      style: {
        width: '100%',
      },
    },
    rules: [
      {
        required: true,
        message: 'Please select a analysis_step',
        trigger: 'change',
      },
    ],
    children: [
      {
        type: 'select-option',
        value: 'DR:PCA',
        label: 'DR:PCA',
      },
      {
        type: 'select-option',
        value: 'DR:Umap',
        label: 'DR:Umap',
      },
      {
        type: 'select-option',
        value: 'DR:Pacmap',
        label: 'DR:Pacmap',
      },
      {
        type: 'select-option',
        value: 'DR:ICA',
        label: 'DR:ICA',
      },
      {
        type: 'select-option',
        value: 'DR:SPE',
        label: 'DR:SPE',
      },
      {
        type: 'select-option',
        value: 'DR:SNE',
        label: 'DR:SNE',
      },
      {
        type: 'select-option',
        value: 'DR:TriMap',
        label: 'DR:TriMap',
      },
      {
        type: 'select-option',
        value: 'Cluster:kmeans',
        label: 'Cluster:kmeans',
      },
      {
        type: 'select-option',
        value: 'Cluster:DBSCAN',
        label: 'Cluster:DBSCAN',
      },
      {
        type: 'select-option',
        value: 'Cluster:meanshift',
        label: 'Cluster:meanshift',
      },
      {
        type: 'select-option',
        value: 'Cluster:birch',
        label: 'Cluster:birch',
      },
      {
        type: 'select-option',
        value: 'Cluster:HDBSCAN',
        label: 'Cluster:HDBSCAN',
      },
    ],
  },
  {
    type: 'select',
    value: null,
    label: 'Parameter',
    required: 'analysis_var',
    prop: 'analysis_var',
    placeholder: 'Please select a analysis_var',
    attrs: {
      allowClear: true,
      style: {
        width: '100%',
      },
    },
    rules: [
      {
        required: true,
        message: 'Please select a analysis_var',
        trigger: 'change',
      },
    ],
    children: [
      {
        type: 'select-option',
        value: 'n_components',
        label: 'n_components',
      },
      {
        type: 'select-option',
        value: 'n_clusters',
        label: 'n_clusters',
      },
    ],
  },
  {
    type: 'input-number',
    value: null,
    prop: 'custom',
    attrs: {
      style: {
        display: 'none',
      },
    },
  },
  {
    type: 'input-number',
    value: null,
    label: 'Start Value',
    required: 'start_value',
    prop: 'start_value',
    attrs: {
      min: 1,
      max: 50,
      allowClear: true,
      style: {
        width: '100%',
      },
    },
    rules: [
      {
        required: true,
        message: 'The number of start_value is between 1 and 50',
        trigger: 'blur',
      },
    ],
  },
  {
    type: 'input-number',
    value: null,
    label: 'End Value (not include)',
    required: 'end_value',
    prop: 'end_value',
    attrs: {
      min: 1,
      max: 50,
      allowClear: true,
      style: {
        width: '100%',
      },
    },
    rules: [
      {
        required: true,
        message: 'The number of end_value is between 1 and 50',
        trigger: 'blur',
      },
    ],
  },
  {
    type: 'input-number',
    value: null,
    label: 'Interval Step',
    required: 'step_value',
    prop: 'step_value',
    attrs: {
      min: 1,
      max: 50,
      allowClear: true,
      style: {
        width: '100%',
      },
    },
    rules: [
      {
        required: true,
        message: 'The number of step_value is between 1 and 50',
        trigger: 'blur',
      },
    ],
  },
]

export const indexConfig = {
  columns: [
    { align: 'center', dataIndex: 'name', title: 'Case Name' },
    { align: 'center', dataIndex: 'status', title: 'Case Status', customRender: ({ text }: { text: string }) => {
      return text === CASE_STATUS.HAS_RESULT ? <a-tag color="green">{text}</a-tag> : text
    } },
    { align: 'center', dataIndex: 'remark', title: 'Remark' },
    // 需要使用tsx文件后缀这里的组件才不会报错
    // { align: 'center', dataIndex: 'disabled', title: 'Disabled', customRender: ({ text }: { text: string }) => {
    //   return <a-switch checked={text === '1'} disabled />
    // } },
    // { align: 'center', dataIndex: 'shared', title: 'Shared', customRender: ({ text }: { text: string }) => {
    //   return <a-switch checked={text === '1'} disabled />
    // } },
    // { align: 'center', dataIndex: 'createdTime', title: 'CreatedTime' },
    { align: 'center', dataIndex: 'lastUpdateTime', title: 'LastUpdateTime' },
    { dataIndex: 'action', title: 'Acticon' },
  ],
  text: {
    refresh: true,
    refreshAction: 'Refresh',
    searchAction: 'Search',
    addAction: 'New',
    addModalTitle: 'New Case',
    editAction: 'Edit Info',
    editModalTitle: 'Update Case',
    detailAction: 'Run Case',
    deleteAction: 'Delete',
    deletePopTitle: 'Are you sure delete this case?',
    popNoText: 'No',
    popYesText: 'Yes',
  },
  options: caseFormOptions,
  searchFormOptions,
  searchFormLayout,
}

export const formConfig = {
  processes,
  baseFormLayout,
  selectFormOptions,
  cleanFormOptions,
  samplingFormOptions,
  normalizationFormOptions,
  DRFormOptions,
  clusterFormOptions,
}

export const somConfig = {
  somFormOptions,
}

export const contributionConfig = {
  contributionFormOptions,
}

export const optimizationConfig = {
  optimizationFormOptions,
  optimizationColumns,
}

export const sensitiveConfig = {
  sensitiveFormOptions,
}
